package com.iflytek.nacos.manager.biz;

import com.alibaba.nacos.api.config.annotation.NacosValue;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import static org.springframework.web.bind.annotation.RequestMethod.GET;

/**
 * @program: springCloudAlibaba
 * @description:
 * @author: 陈亮
 * @create: 2022-01-17 20:40
 */
@Controller
@RequestMapping("config")
public class ConfigBiz {

    /**
     * 此处没有nacos没有配置useLocalCache的时候,默认返回的false,
     * 但是在nacos配置了,返回的就是true了,并且没有重启服务,做到自动刷新了
     */

    @NacosValue(value = "${useLocalCache:false}", autoRefreshed = true)
    private boolean useLocalCache;

    @RequestMapping(value = "/get", method = GET)
    @ResponseBody
    public boolean get() {
        return useLocalCache;
    }
}
